<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="text" id="a">
	<span id="b"></span>

	<script>
		var obj = {};
		Object.defineProperty(obj, "name", {
			set:function(newVal){
				document.getElementById("a").value = newVal;
				document.getElementById("b").innerHTML = newVal;
			}
		});

		document.addEventListener('keyup',function(e){
			obj.name = e.target.value;
		});
	</script>
</body>
</html>